package com.cloud.collection.service.serviceImpl;

import com.cloud.collection.dao.Goods_starMapper;
import com.cloud.collection.service.CollectionService;
import com.cloud.commonapi.model.Goods_info;
import com.cloud.commonapi.model.Goods_star;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * author : 黄永佳
 * create : 2019/9/30 0030 8:40
 * modified :
 * 功能 :
 **/
@Service
public class CollectionServiceImpl implements CollectionService {
    @Autowired
    Goods_starMapper goods_starMapper;

    @Override
    public int add(Goods_star goods_star) {
        return goods_starMapper.insert(goods_star);
    }

    @Override
    public List<Goods_info> findAll(int accountId) {
        return goods_starMapper.selectByAccountId(accountId);
    }

    @Override
    public int delete(int id,int accountId) {
        return goods_starMapper.deleteById(id,accountId);
    }

    @Override
    public boolean already(int goodsId, int accountId) {
        if(goods_starMapper.selectAlready(goodsId,accountId)!=null){
            return true;
        }else {
            return false;
        }
    }
}
